#ifndef REMINDERWIDGET_H
#define REMINDERWIDGET_H

#include <QWidget>
#include <QTabWidget>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QCheckBox>
#include <QComboBox>
#include <QSpinBox>
#include <QPushButton>
#include <QRadioButton>
#include "config/GlobalDefine.h"

class FileLineEdit;
class ReminderWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ReminderWidget(QWidget *parent = nullptr);
signals:
    void sigClose();
private:
    void setupForm();
    void initData();
    void saveData();

    void setSoundData();
    void getSoundData();
    // 全局声音控制（即时生效）
    void connectGlobalSoundControls();
private slots:
    void onSaveDataBtn();
    void onMuteChanged(int state);
    void onVolumeChanged(int value);
    void onTickEnableChanged(int state);
    void onTickIntervalChanged(int value);
    void onPreviewStart();
    void onPreviewAlarm1();
    void onPreviewAlarm2();
    void onPreviewAlarm3();
    void onPreviewTimeout();
    void onPreviewEnd();
private:
    FileLineEdit* startSoundFileEdit;
    FileLineEdit* warn1SoundFileEdit;
    FileLineEdit* warn2SoundFileEdit;
    FileLineEdit* warn3SoundFileEdit;
    FileLineEdit* timeoutSoundFileEdit;
    FileLineEdit* endSoundFileEdit;
    QCheckBox *startSoundCombo;

    QCheckBox *warn1SoundCombo;
    QCheckBox *warn1FlashCombo;
    QCheckBox *warn1TextCombo;

    QCheckBox *warn2SoundCombo;
    QCheckBox *warn2FlashCombo;
    QCheckBox *warn2TextCombo;

    QCheckBox *warn3SoundCombo;
    QCheckBox *warn3FlashCombo;
    QCheckBox *warn3TextCombo;

    QCheckBox *timeoutSoundCombo;
    QCheckBox *timeoutFlashCombo;
    QCheckBox *timeoutTextCombo;

    QCheckBox *endSoundCombo;
    QCheckBox *endTextCombo;

    QSpinBox *durationSpinBox;
    QComboBox *timeoutCombo;
    QCheckBox *orderCheck;
    QCheckBox *screenSaverCheck;
    QCheckBox *hotkeyCheck;

    QPushButton *btnSpecialCount;
    QPushButton *btnHelp;
    QPushButton *btnApply;
    QPushButton *btnClose;
private:
    SoundSettings m_soundSettings;

    // 全局声音控件
    QCheckBox *chkMuted;
    QSlider *sliderVolume;
    QLabel *lblVolumeValue;
    QCheckBox *chkTickEnable;
    QSpinBox *spinTickInterval;
    QPushButton *btnPreviewStart;
    QPushButton *btnPreviewAlarm1;
    QPushButton *btnPreviewAlarm2;
    QPushButton *btnPreviewAlarm3;
    QPushButton *btnPreviewTimeout;
    QPushButton *btnPreviewEnd;
};

#endif // REMINDERWIDGET_H
